{extends file="../acp.html"}

{block name="title"}{$head_title}{/block}
{block name="content"}
<script>
    function no_pic(obj) {
        obj.setAttribute("src", "/Public/Images/acp/nopicture.jpg");
    }
</script>

<div class="tablesWrap">
    <div class="tables-searchbox">
        <!--<form method="post">-->
            <!--<span class="tbs-txt">帖子名称：</span>-->
            <!--<input type="text" name="post_name" value="{$post_name}">-->

            <!--<span class="tbs-txt">发帖人：</span>-->
            <!--<input type="text" name="user_name" value="{$user_name}">-->

            <!--<select name="channel_id">-->
                <!--<option value="">-所属频道-</option>-->
                <!--{foreach from=$channel_list item=v}-->
                <!--<option value="{$v.channel_id}" {if $channel_id == $v.channel_id}selected{/if}>{$v.channel_name}</option>-->
                <!--{/foreach}-->
            <!--</select>-->

            <!--<button type="submit" class="btn"><i class="gicon-search"></i>搜索</button>-->
        <!--</form>-->
    </div>
    <!-- end tables-searchbox -->
    <table class="wxtables">
        <colgroup>
            <!-- <col width="7%"> -->
            <col width="5%">
            <col width="10%">
            <col width="25%">
            <col width="4%">
            <col width="4%">
            <col width="5%">
        </colgroup>
        <thead>
        <tr>
            <!-- <td>选择</td> -->
            <td>用户名称</td>
            <td>答案内容</td>
            <td>答案照片</td>
            <td>是否采纳</td>
            <td>添加时间</td>
            <td>操作</td>
        </tr>
        </thead>
        <tbody>
        {foreach from=$reward_answer_list  item=v }
        <tr>
            <!-- <td><input type="checkbox" class="checkbox" value="{$incubator.incubator_id}" name="checkIds[]"></td> -->
            <td>{$v.nickname}</td>
            <td>{$v.content}</td>
            <td>{foreach from = $v.imgs item = img}<img src="{$img}" style="width: 100px;">{/foreach}</td>
            <td>{if $v.is_adopt}是{else}否{/if}</td>
            <td>{$v.acp_time}</td>
            <td>
                {if !$v.is_adopt}
                <a href="javascript:;" onclick="del_answer({$v.reward_answer_id});" class="btn" title="删除"><i class="gicon-trash black"></i>删除</a>
                {/if}
            </td>
        </tr>
        {foreachelse}
        <tr><td colspan="10">没有找到任何记录</td></tr>
        {/foreach}
        </tbody>
    </table>
    <!-- end wxtables -->
    <div class="tables-btmctrl clearfix">
        <!-- <div class="fl">
            <a href="javascript:selall()" class="btn btn-blue">全选</a>
            <a href="javascript:clearall()" class="btn btn-blue">取消</a>
            <a href="javascript:;" class="btn btn-blue J_batch_store">下架</a>
            <a href="javascript:;" class="btn btn-blue" onclick="delIncubatorBatch()">删除</a>
        </div> -->
        <div class="fr">
            <div class="paginate">
                {$show}
            </div>
            <!-- end paginate -->
        </div>
    </div>
    <!-- end tables-btmctrl -->
</div>
<!-- end tablesWrap -->
{/block}

{block name="js"}
<script src="/Public/Plugins/My97DatePicker/WdatePicker.js?version={$version}"></script>
<script src="__JS__/front/jquery.showLoading.min.js?version={$version}"></script>
<script src="__JS__/clipboard.min.js"></script>
<link rel="stylesheet" href="__CSS__/front/showLoading.css?version={$version}">
{literal}
<script>

    function del_answer(reward_answer_id)
    {
        var html = "确认删除这个答案吗?";
        $.jPops.custom({
            title:"删除帖子",
            content:html,
            okBtnTxt:"确定",
            cancelBtnTxt:"取消",
            callback:function(r)
            {
                if(r)
                {
                    $.post('/AcpPost/del_answer',{'reward_answer_id':reward_answer_id},function(data) {
                        console.log(data)
                        if (data == 'success') {
                            alert('删除成功');
                            location.reload();
                        } else {
                            alert('删除失败，请稍后再试');
                        }
                    });
                }
                return true;
            }
        });
    }

</script>
{/literal}
{/block}
